﻿@using Kunlun.BusinessLogic
@model IEnumerable<Kunlun.Models.Order>
@{
    ViewBag.Title = "个人信息管理";
}
@section Head{
    <link href="@Url.Content("~/Content/base/basic.css")" rel="stylesheet" type="text/css" />
    <script language="javascript"  src="@Url.Content("~/content/base/jquery.simplemodal.js")" ></script>
    <link href="@Url.Content("~/Content/member/Style.css")" rel="stylesheet" type="text/css" />
    <script language="javascript">
        $(function () {
            $(".ordershow").click(function () {
                var id = $(this).attr("data-id");
                if ($("#" + id).css("display") == "none") {
                    $("#" + id).fadeIn('slow');
                }
                else { $("#" + id).fadeOut('slow'); }
            })
            $(".payorder").click(function () {
                $('#basic-modal-content').modal()
                var id = $(this).attr("data-id");
                $.get("/MyKunlun/OrderPay/" + id, function (data) {
                    $('#basic-modal-content').html(data);
                });

            })

        });
    </script>
}
<div id="content">
    @Html.Partial("_MymenuPartial")
    <fieldset class="right">
        <legend>已完成订单</legend>
        <table>
            <tr>
                <th>
                    状态
                </th>
                <th>
                    订单号
                </th>
                <th>
                    配送方式
                </th>
                <th>
                    费用
                </th>
                <th>
                    快递费
                </th>
                <th>
                    地址
                </th>
                <th>
                    联系电话
                </th>
                <th>
                    快递单号
                </th>
                <th>
                    操作
                </th>
            </tr>
            @foreach (var item in Model)
            {
                <tr>
                    <td>
                        @Enum.GetName(typeof(OrderState), item.Status)
                    </td>
                    <td>
                        @Html.DisplayFor(modelItem => item.Oid)
                    </td>
                    <td>
                        @Html.DisplayFor(modelItem => item.DeliveType.Name)
                    </td>
                    <td>
                        @Html.DisplayFor(modelItem => item.Price)
                    </td>
                    <td>
                        @Html.DisplayFor(modelItem => item.Sendprice)
                    </td>
                    <td>
                        @Html.DisplayFor(modelItem => item.AddressInfo)
                    </td>
                    <td>
                        @Html.DisplayFor(modelItem => item.Connections)
                    </td>
                    <td>
                        @Html.DisplayFor(modelItem => item.ExpressNum)
                    </td>
                    <td>
                        <a href="javascript:void(0)" class="ordershow" data-id="@item.Oid">查看详细</a>
                    </td>
                </tr>
                <tr id="@item.Oid" style="display:none">
                    <td colspan="9">
                        <table>
                            @foreach (var detail in item.Orderdetail)
                            { 
                                <tr>
                                    <td>
                                        @if (@detail.Types != 0)
                                        {
                                            @detail.ItemNumber  @detail.ProductName  <text>[</text>@Enum.GetName(typeof(Types), detail.Types)<text>]</text><td>@detail.Oneprice
                                            </td>
                                        }
                                        else
                                        { 
                                            <text>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</text>@detail.ProductName <td>@detail.Remark
                                            </td>
                                        }
                                    </td>
                                </tr>
                            }
                        </table>
                    </td>
                </tr>
            }
        </table>
    </fieldset>
    <fieldset class="right">
        <legend>未完成订单</legend>
        <table>
            <tr>
                <th>
                    状态
                </th>
                <th>
                    订单号
                </th>
                <th>
                    支付方式
                </th>
                <th>
                    配送方式
                </th>
                <th>
                    费用
                </th>
                <th>
                    快递费
                </th>
                <th>
                    地址
                </th>
                <th>
                    联系电话
                </th>
                <th>
                    操作
                </th>
            </tr>
            @foreach (var item in ViewBag.OnComplete as IEnumerable<Kunlun.Models.Order>)
            {
                <tr>
                    <td>
                        @Enum.GetName(typeof(OrderState), item.Status)
                    </td>
                    <td>
                        @Html.DisplayFor(modelItem => item.Oid)
                    </td>
                    <td>
                        @Html.DisplayFor(modelItem => item.Paymethod.Name)
                    </td>
                    <td>
                        @Html.DisplayFor(modelItem => item.DeliveType.Name)
                    </td>
                    <td>
                        @Html.DisplayFor(modelItem => item.Price)
                    </td>
                    <td>
                        @Html.DisplayFor(modelItem => item.Sendprice)
                    </td>
                    <td>
                        @Html.DisplayFor(modelItem => item.AddressInfo)
                    </td>
                    <td>
                        @Html.DisplayFor(modelItem => item.Connections)
                    </td>
                    <td>
                        <a href="javascript:void(0)" class="payorder" data-id="@item.Oid">支付订单</a> <a href="javascript:void(0)" class="ordershow" data-id="@item.Oid">
                            查看详细</a>
                    </td>
                </tr>
                <tr id="@item.Oid" style="display:none">
                    <td colspan="9">
                        <table>
                            @foreach (var detail in item.Orderdetail)
                            { 
                                <tr>
                                    <td>
                                        @if (@detail.Types != 0)
                                        {
                                            @detail.ItemNumber  @detail.ProductName  <text>[</text>@Enum.GetName(typeof(Types), detail.Types)<text>]</text><td>@detail.Oneprice
                                            </td>
                                        }
                                        else
                                        { 
                                            <text>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</text>@detail.ProductName <td>@detail.Remark
                                            </td>
                                        }
                                    </td>
                                </tr>
                            }
                        </table>
                    </td>
                </tr>
            }
        </table>
    </fieldset>
</div>
<div id="basic-modal-content">
    <h3>
        页面载入中......</h3>
</div>
